home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / mint / gcc / gcc261a.zoo / info / gcc.info-9 < prev    next >
Encoding:
GNU Info File  |  1994-10-31  |  43.3 KB  |  986 lines

  1. This is Info file gcc.info, produced by Makeinfo-1.54 from the input
  2. file gcc.texi.
  3.  
  4.    This file documents the use and the internals of the GNU compiler.
  5.  
  6.    Published by the Free Software Foundation 675 Massachusetts Avenue
  7. Cambridge, MA 02139 USA
  8.  
  9.    Copyright (C) 1988, 1989, 1992, 1993 Free Software Foundation, Inc.
  10.  
  11.    Permission is granted to make and distribute verbatim copies of this
  12. manual provided the copyright notice and this permission notice are
  13. preserved on all copies.
  14.  
  15.    Permission is granted to copy and distribute modified versions of
  16. this manual under the conditions for verbatim copying, provided also
  17. that the sections entitled "GNU General Public License" and "Protect
  18. Your Freedom--Fight `Look And Feel'" are included exactly as in the
  19. original, and provided that the entire resulting derived work is
  20. distributed under the terms of a permission notice identical to this
  21. one.
  22.  
  23.    Permission is granted to copy and distribute translations of this
  24. manual into another language, under the above conditions for modified
  25. versions, except that the sections entitled "GNU General Public
  26. License" and "Protect Your Freedom--Fight `Look And Feel'", and this
  27. permission notice, may be included in translations approved by the Free
  28. Software Foundation instead of in the original English.
  29.  
  30. File: gcc.info,  Node: C++ Interface,  Next: C++ Signatures,  Prev: Destructors and Goto,  Up: C++ Extensions
  31.  
  32. Declarations and Definitions in One Header
  33. ==========================================
  34.  
  35.    C++ object definitions can be quite complex.  In principle, your
  36. source code will need two kinds of things for each object that you use
  37. across more than one source file.  First, you need an "interface"
  38. specification, describing its structure with type declarations and
  39. function prototypes.  Second, you need the "implementation" itself.  It
  40. can be tedious to maintain a separate interface description in a header
  41. file, in parallel to the actual implementation.  It is also dangerous,
  42. since separate interface and implementation definitions may not remain
  43. parallel.
  44.  
  45.    With GNU C++, you can use a single header file for both purposes.
  46.  
  47.      *Warning:* The mechanism to specify this is in transition.  For the
  48.      nonce, you must use one of two `#pragma' commands; in a future
  49.      release of GNU C++, an alternative mechanism will make these
  50.      `#pragma' commands unnecessary.
  51.  
  52.    The header file contains the full definitions, but is marked with
  53. `#pragma interface' in the source code.  This allows the compiler to
  54. use the header file only as an interface specification when ordinary
  55. source files incorporate it with `#include'.  In the single source file
  56. where the full implementation belongs, you can use either a naming
  57. convention or `#pragma implementation' to indicate this alternate use
  58. of the header file.
  59.  
  60. `#pragma interface'
  61.      Use this directive in *header files* that define object classes,
  62.      to save space in most of the object files that use those classes.
  63.      Normally, local copies of certain information (backup copies of
  64.      inline member functions, debugging information, and the internal
  65.      tables that implement virtual functions) must be kept in each
  66.      object file that includes class definitions.  You can use this
  67.      pragma to avoid such duplication.  When a header file containing
  68.      `#pragma interface' is included in a compilation, this auxiliary
  69.      information will not be generated (unless the main input source
  70.      file itself uses `#pragma implementation').  Instead, the object
  71.      files will contain references to be resolved at link time.
  72.  
  73. `#pragma implementation'
  74. `#pragma implementation "OBJECTS.h"'
  75.      Use this pragma in a *main input file*, when you want full output
  76.      from included header files to be generated (and made globally
  77.      visible).  The included header file, in turn, should use `#pragma
  78.      interface'.  Backup copies of inline member functions, debugging
  79.      information, and the internal tables used to implement virtual
  80.      functions are all generated in implementation files.
  81.  
  82.      `#pragma implementation' is *implied* whenever the basename(1) of
  83.      your source file matches the basename of a header file it
  84.      includes.  There is no way to turn this off (other than using a
  85.      different name for one of the two files).  In the same vein, if
  86.      you use `#pragma implementation' with no argument, it applies to an
  87.      include file with the same basename as your source file.  For
  88.      example, in `allclass.cc', `#pragma implementation' by itself is
  89.      equivalent to `#pragma implementation "allclass.h"'; but even if
  90.      you do not say `#pragma implementation' at all, `allclass.h' is
  91.      treated as an implementation file whenever you include it from
  92.      `allclass.cc'.
  93.  
  94.      If you use an explicit `#pragma implementation', it must appear in
  95.      your source file *before* you include the affected header files.
  96.  
  97.      Use the string argument if you want a single implementation file to
  98.      include code from multiple header files.  (You must also use
  99.      `#include' to include the header file; `#pragma implementation'
  100.      only specifies how to use the file--it doesn't actually include
  101.      it.)
  102.  
  103.      There is no way to split up the contents of a single header file
  104.      into multiple implementation files.
  105.  
  106.    `#pragma implementation' and `#pragma interface' also have an effect
  107. on function inlining.
  108.  
  109.    If you define a class in a header file marked with `#pragma
  110. interface', the effect on a function defined in that class is similar to
  111. an explicit `extern' declaration--the compiler emits no code at all to
  112. define an independent version of the function.  Its definition is used
  113. only for inlining with its callers.
  114.  
  115.    Conversely, when you include the same header file in a main source
  116. file that declares it as `#pragma implementation', the compiler emits
  117. code for the function itself; this defines a version of the function
  118. that can be found via pointers (or by callers compiled without
  119. inlining).
  120.  
  121.    ---------- Footnotes ----------
  122.  
  123.    (1)  A file's "basename" is the name stripped of all leading path
  124. information and of trailing suffixes, such as `.h' or `.C' or `.cc'.
  125.  
  126. File: gcc.info,  Node: C++ Signatures,  Prev: C++ Interface,  Up: C++ Extensions
  127.  
  128. Type Abstraction using Signatures
  129. =================================
  130.  
  131.    In GNU C++, you can use the keyword `signature' to define a
  132. completely abstract class interface as a datatype.  You can connect this
  133. abstraction with actual classes using signature pointers.  If you want
  134. to use signatures, run the GNU compiler with the `-fhandle-signatures'
  135. command-line option.  (With this option, the compiler reserves a second
  136. keyword `sigof' as well, for a future extension.)
  137.  
  138.    Roughly, signatures are type abstractions or interfaces of classes.
  139. Some other languages have similar facilities.  C++ signatures are
  140. related to ML's signatures, Haskell's type classes, definition modules
  141. in Modula-2, interface modules in Modula-3, abstract types in Emerald,
  142. type modules in Trellis/Owl, categories in Scratchpad II, and types in
  143. POOL-I.  For a more detailed discussion of signatures, see `Signatures:
  144. A C++ Extension for Type Abstraction and Subtype Polymorphism' by
  145. Gerald Baumgartner and Vincent F. Russo (Tech report CSD-TR-93-059,
  146. Dept. of Computer Sciences, Purdue University, September 1993, to
  147. appear in *Software Practice & Experience*).  You can get the tech
  148. report by anonymous FTP from `ftp.cs.purdue.edu' in
  149. `pub/reports/TR93-059.PS.Z'.
  150.  
  151.    Syntactically, a signature declaration is a collection of member
  152. function declarations and nested type declarations.  For example, this
  153. signature declaration defines a new abstract type `S' with member
  154. functions `int foo ()' and `int bar (int)':
  155.  
  156.      signature S
  157.      {
  158.        int foo ();
  159.        int bar (int);
  160.      };
  161.  
  162.    Since signature types do not include implementation definitions, you
  163. cannot write an instance of a signature directly.  Instead, you can
  164. define a pointer to any class that contains the required interfaces as a
  165. "signature pointer".  Such a class "implements" the signature type.
  166.  
  167.    To use a class as an implementation of `S', you must ensure that the
  168. class has public member functions `int foo ()' and `int bar (int)'.
  169. The class can have other member functions as well, public or not; as
  170. long as it offers what's declared in the signature, it is suitable as
  171. an implementation of that signature type.
  172.  
  173.    For example, suppose that `C' is a class that meets the requirements
  174. of signature `S' (`C' "conforms to" `S').  Then
  175.  
  176.      C obj;
  177.      S * p = &obj;
  178.  
  179. defines a signature pointer `p' and initializes it to point to an
  180. object of type `C'.  The member function call `int i = p->foo ();'
  181. executes `obj.foo ()'.
  182.  
  183.    Abstract virtual classes provide somewhat similar facilities in
  184. standard C++.  There are two main advantages to using signatures
  185. instead:
  186.  
  187.   1. Subtyping becomes independent from inheritance.  A class or
  188.      signature type `T' is a subtype of a signature type `S'
  189.      independent of any inheritance hierarchy as long as all the member
  190.      functions declared in `S' are also found in `T'.  So you can
  191.      define a subtype hierarchy that is completely independent from any
  192.      inheritance (implementation) hierarchy, instead of being forced to
  193.      use types that mirror the class inheritance hierarchy.
  194.  
  195.   2. Signatures allow you to work with existing class hierarchies as
  196.      implementations of a signature type.  If those class hierarchies
  197.      are only available in compiled form, you're out of luck with
  198.      abstract virtual classes, since an abstract virtual class cannot
  199.      be retrofitted on top of existing class hierarchies.  So you would
  200.      be required to write interface classes as subtypes of the abstract
  201.      virtual class.
  202.  
  203.    There is one more detail about signatures.  A signature declaration
  204. can contain member function *definitions* as well as member function
  205. declarations.  A signature member function with a full definition is
  206. called a *default implementation*; classes need not contain that
  207. particular interface in order to conform.  For example, a class `C' can
  208. conform to the signature
  209.  
  210.      signature T
  211.      {
  212.        int f (int);
  213.        int f0 () { return f (0); };
  214.      };
  215.  
  216. whether or not `C' implements the member function `int f0 ()'.  If you
  217. define `C::f0', that definition takes precedence; otherwise, the
  218. default implementation `S::f0' applies.
  219.  
  220. File: gcc.info,  Node: Trouble,  Next: Bugs,  Prev: C++ Extensions,  Up: Top
  221.  
  222. Known Causes of Trouble with GNU CC
  223. ***********************************
  224.  
  225.    This section describes known problems that affect users of GNU CC.
  226. Most of these are not GNU CC bugs per se--if they were, we would fix
  227. them.  But the result for a user may be like the result of a bug.
  228.  
  229.    Some of these problems are due to bugs in other software, some are
  230. missing features that are too much work to add, and some are places
  231. where people's opinions differ as to what is best.
  232.  
  233. * Menu:
  234.  
  235. * Actual Bugs::              Bugs we will fix later.
  236. * Installation Problems::     Problems that manifest when you install GNU CC.
  237. * Cross-Compiler Problems::   Common problems of cross compiling with GNU CC.
  238. * Interoperation::      Problems using GNU CC with other compilers,
  239.                and with certain linkers, assemblers and debuggers.
  240. * External Bugs::    Problems compiling certain programs.
  241. * Incompatibilities::   GNU CC is incompatible with traditional C.
  242. * Fixed Headers::       GNU C uses corrected versions of system header files.
  243.                            This is necessary, but doesn't always work smoothly.
  244. * Disappointments::     Regrettable things we can't change, but not quite bugs.
  245. * C++ Misunderstandings::     Common misunderstandings with GNU C++.
  246. * Protoize Caveats::    Things to watch out for when using `protoize'.
  247. * Non-bugs::        Things we think are right, but some others disagree.
  248. * Warnings and Errors:: Which problems in your code get warnings,
  249.                          and which get errors.
  250.  
  251. File: gcc.info,  Node: Actual Bugs,  Next: Installation Problems,  Up: Trouble
  252.  
  253. Actual Bugs We Haven't Fixed Yet
  254. ================================
  255.  
  256.    * The `fixincludes' script interacts badly with automounters; if the
  257.      directory of system header files is automounted, it tends to be
  258.      unmounted while `fixincludes' is running.  This would seem to be a
  259.      bug in the automounter.  We don't know any good way to work around
  260.      it.
  261.  
  262.    * The `fixproto' script will sometimes add prototypes for the
  263.      `sigsetjmp' and `siglongjmp' functions that reference the
  264.      `jmp_buf' type before that type is defined.  To work around this,
  265.      edit the offending file and place the typedef in front of the
  266.      prototypes.
  267.  
  268.    * Loop unrolling doesn't work properly for certain C++ programs.
  269.      This is because of difficulty in updating the debugging
  270.      information within the loop being unrolled.  We plan to revamp the
  271.      representation of debugging information so that this will work
  272.      properly, but we have not done this in version 2.6 because we
  273.      don't want to delay it any further.
  274.  
  275. File: gcc.info,  Node: Installation Problems,  Next: Cross-Compiler Problems,  Prev: Actual Bugs,  Up: Trouble
  276.  
  277. Installation Problems
  278. =====================
  279.  
  280.    This is a list of problems (and some apparent problems which don't
  281. really mean anything is wrong) that show up during installation of GNU
  282. CC.
  283.  
  284.    * On certain systems, defining certain environment variables such as
  285.      `CC' can interfere with the functioning of `make'.
  286.  
  287.    * If you encounter seemingly strange errors when trying to build the
  288.      compiler in a directory other than the source directory, it could
  289.      be because you have previously configured the compiler in the
  290.      source directory.  Make sure you have done all the necessary
  291.      preparations.  *Note Other Dir::.
  292.  
  293.    * If you build GNU CC on a BSD system using a directory stored in a
  294.      System V file system, problems may occur in running `fixincludes'
  295.      if the System V file system doesn't support symbolic links.  These
  296.      problems result in a failure to fix the declaration of `size_t' in
  297.      `sys/types.h'.  If you find that `size_t' is a signed type and
  298.      that type mismatches occur, this could be the cause.
  299.  
  300.      The solution is not to use such a directory for building GNU CC.
  301.  
  302.    * In previous versions of GNU CC, the `gcc' driver program looked for
  303.      `as' and `ld' in various places; for example, in files beginning
  304.      with `/usr/local/lib/gcc-'.  GNU CC version 2 looks for them in
  305.      the directory `/usr/local/lib/gcc-lib/TARGET/VERSION'.
  306.  
  307.      Thus, to use a version of `as' or `ld' that is not the system
  308.      default, for example `gas' or GNU `ld', you must put them in that
  309.      directory (or make links to them from that directory).
  310.  
  311.    * Some commands executed when making the compiler may fail (return a
  312.      non-zero status) and be ignored by `make'.  These failures, which
  313.      are often due to files that were not found, are expected, and can
  314.      safely be ignored.
  315.  
  316.    * It is normal to have warnings in compiling certain files about
  317.      unreachable code and about enumeration type clashes.  These files'
  318.      names begin with `insn-'.  Also, `real.c' may get some warnings
  319.      that you can ignore.
  320.  
  321.    * Sometimes `make' recompiles parts of the compiler when installing
  322.      the compiler.  In one case, this was traced down to a bug in
  323.      `make'.  Either ignore the problem or switch to GNU Make.
  324.  
  325.    * If you have installed a program known as purify, you may find that
  326.      it causes errors while linking `enquire', which is part of building
  327.      GNU CC.  The fix is to get rid of the file `real-ld' which purify
  328.      installs--so that GNU CC won't try to use it.
  329.  
  330.    * On Linux SLS 1.01, there is a problem with `libc.a': it does not
  331.      contain the obstack functions.  However, GNU CC assumes that the
  332.      obstack functions are in `libc.a' when it is the GNU C library.
  333.      To work around this problem, change the `__GNU_LIBRARY__'
  334.      conditional around line 31 to `#if 1'.
  335.  
  336.    * On some 386 systems, building the compiler never finishes because
  337.      `enquire' hangs due to a hardware problem in the motherboard--it
  338.      reports floating point exceptions to the kernel incorrectly.  You
  339.      can install GNU CC except for `float.h' by patching out the
  340.      command to run `enquire'.  You may also be able to fix the problem
  341.      for real by getting a replacement motherboard.  This problem was
  342.      observed in Revision E of the Micronics motherboard, and is fixed
  343.      in Revision F.  It has also been observed in the MYLEX MXA-33
  344.      motherboard.
  345.  
  346.      If you encounter this problem, you may also want to consider
  347.      removing the FPU from the socket during the compilation.
  348.      Alternatively, if you are running SCO Unix, you can reboot and
  349.      force the FPU to be ignored.  To do this, type `hd(40)unix auto
  350.      ignorefpu'.
  351.  
  352.    * On some 386 systems, GNU CC crashes trying to compile `enquire.c'.
  353.      This happens on machines that don't have a 387 FPU chip.  On 386
  354.      machines, the system kernel is supposed to emulate the 387 when you
  355.      don't have one.  The crash is due to a bug in the emulator.
  356.  
  357.      One of these systems is the Unix from Interactive Systems: 386/ix.
  358.      On this system, an alternate emulator is provided, and it does
  359.      work.  To use it, execute this command as super-user:
  360.  
  361.           ln /etc/emulator.rel1 /etc/emulator
  362.  
  363.      and then reboot the system.  (The default emulator file remains
  364.      present under the name `emulator.dflt'.)
  365.  
  366.      Try using `/etc/emulator.att', if you have such a problem on the
  367.      SCO system.
  368.  
  369.      Another system which has this problem is Esix.  We don't know
  370.      whether it has an alternate emulator that works.
  371.  
  372.      On NetBSD 0.8, a similar problem manifests itself as these error
  373.      messages:
  374.  
  375.           enquire.c: In function `fprop':
  376.           enquire.c:2328: floating overflow
  377.  
  378.    * On SCO systems, when compiling GNU CC with the system's compiler,
  379.      do not use `-O'.  Some versions of the system's compiler miscompile
  380.      GNU CC with `-O'.
  381.  
  382.    * Sometimes on a Sun 4 you may observe a crash in the program
  383.      `genflags' or `genoutput' while building GNU CC.  This is said to
  384.      be due to a bug in `sh'.  You can probably get around it by running
  385.      `genflags' or `genoutput' manually and then retrying the `make'.
  386.  
  387.    * On Solaris 2, executables of GNU CC version 2.0.2 are commonly
  388.      available, but they have a bug that shows up when compiling current
  389.      versions of GNU CC: undefined symbol errors occur during assembly
  390.      if you use `-g'.
  391.  
  392.      The solution is to compile the current version of GNU CC without
  393.      `-g'.  That makes a working compiler which you can use to recompile
  394.      with `-g'.
  395.  
  396.    * Solaris 2 comes with a number of optional OS packages.  Some of
  397.      these packages are needed to use GNU CC fully.  If you did not
  398.      install all optional packages when installing Solaris, you will
  399.      need to verify that the packages that GNU CC needs are installed.
  400.  
  401.      To check whether an optional package is installed, use the
  402.      `pkginfo' command.  To add an optional package, use the `pkgadd'
  403.      command.  For further details, see the Solaris documentation.
  404.  
  405.      For Solaris 2.0 and 2.1, GNU CC needs six packages: `SUNWarc',
  406.      `SUNWbtool', `SUNWesu', `SUNWhea', `SUNWlibm', and `SUNWtoo'.
  407.  
  408.      For Solaris 2.2, GNU CC needs an additional seventh package:
  409.      `SUNWsprot'.
  410.  
  411.    * On Solaris 2, trying to use the linker and other tools in
  412.      `/usr/ucb' to install GNU CC has been observed to cause trouble.
  413.      For example, the linker may hang indefinitely.  The fix is to
  414.      remove `/usr/ucb' from your `PATH'.
  415.  
  416.    * If you use the 1.31 version of the MIPS assembler (such as was
  417.      shipped with Ultrix 3.1), you will need to use the
  418.      -fno-delayed-branch switch when optimizing floating point code.
  419.      Otherwise, the assembler will complain when the GCC compiler fills
  420.      a branch delay slot with a floating point instruction, such as
  421.      `add.d'.
  422.  
  423.    * If on a MIPS system you get an error message saying "does not have
  424.      gp sections for all it's [sic] sectons [sic]", don't worry about
  425.      it.  This happens whenever you use GAS with the MIPS linker, but
  426.      there is not really anything wrong, and it is okay to use the
  427.      output file.  You can stop such warnings by installing the GNU
  428.      linker.
  429.  
  430.      It would be nice to extend GAS to produce the gp tables, but they
  431.      are optional, and there should not be a warning about their
  432.      absence.
  433.  
  434.    * In Ultrix 4.0 on the MIPS machine, `stdio.h' does not work with GNU
  435.      CC at all unless it has been fixed with `fixincludes'.  This causes
  436.      problems in building GNU CC.  Once GNU CC is installed, the
  437.      problems go away.
  438.  
  439.      To work around this problem, when making the stage 1 compiler,
  440.      specify this option to Make:
  441.  
  442.           GCC_FOR_TARGET="./xgcc -B./ -I./include"
  443.  
  444.      When making stage 2 and stage 3, specify this option:
  445.  
  446.           CFLAGS="-g -I./include"
  447.  
  448.    * Users have reported some problems with version 2.0 of the MIPS
  449.      compiler tools that were shipped with Ultrix 4.1.  Version 2.10
  450.      which came with Ultrix 4.2 seems to work fine.
  451.  
  452.      Users have also reported some problems with version 2.20 of the
  453.      MIPS compiler tools that were shipped with RISC/os 4.x.  The
  454.      earlier version 2.11 seems to work fine.
  455.  
  456.    * Some versions of the MIPS linker will issue an assertion failure
  457.      when linking code that uses `alloca' against shared libraries on
  458.      RISC-OS 5.0, and DEC's OSF/1 systems.  This is a bug in the
  459.      linker, that is supposed to be fixed in future revisions.  To
  460.      protect against this, GNU CC passes `-non_shared' to the linker
  461.      unless you pass an explicit `-shared' or `-call_shared' switch.
  462.  
  463.    * On System V release 3, you may get this error message while
  464.      linking:
  465.  
  466.           ld fatal: failed to write symbol name SOMETHING
  467.            in strings table for file WHATEVER
  468.  
  469.      This probably indicates that the disk is full or your ULIMIT won't
  470.      allow the file to be as large as it needs to be.
  471.  
  472.      This problem can also result because the kernel parameter `MAXUMEM'
  473.      is too small.  If so, you must regenerate the kernel and make the
  474.      value much larger.  The default value is reported to be 1024; a
  475.      value of 32768 is said to work.  Smaller values may also work.
  476.  
  477.    * On System V, if you get an error like this,
  478.  
  479.           /usr/local/lib/bison.simple: In function `yyparse':
  480.           /usr/local/lib/bison.simple:625: virtual memory exhausted
  481.  
  482.      that too indicates a problem with disk space, ULIMIT, or `MAXUMEM'.
  483.  
  484.    * Current GNU CC versions probably do not work on version 2 of the
  485.      NeXT operating system.
  486.  
  487.    * On NeXTStep 3.0, the Objective C compiler does not work, due,
  488.      apparently, to a kernel bug that it happens to trigger.  This
  489.      problem does not happen on 3.1.
  490.  
  491.    * On the Tower models 4N0 and 6N0, by default a process is not
  492.      allowed to have more than one megabyte of memory.  GNU CC cannot
  493.      compile itself (or many other programs) with `-O' in that much
  494.      memory.
  495.  
  496.      To solve this problem, reconfigure the kernel adding the following
  497.      line to the configuration file:
  498.  
  499.           MAXUMEM = 4096
  500.  
  501.    * On HP 9000 series 300 or 400 running HP-UX release 8.0, there is a
  502.      bug in the assembler that must be fixed before GNU CC can be
  503.      built.  This bug manifests itself during the first stage of
  504.      compilation, while building `libgcc2.a':
  505.  
  506.           _floatdisf
  507.           cc1: warning: `-g' option not supported on this version of GCC
  508.           cc1: warning: `-g1' option not supported on this version of GCC
  509.           ./xgcc: Internal compiler error: program as got fatal signal 11
  510.  
  511.      A patched version of the assembler is available by anonymous ftp
  512.      from `altdorf.ai.mit.edu' as the file
  513.      `archive/cph/hpux-8.0-assembler'.  If you have HP software support,
  514.      the patch can also be obtained directly from HP, as described in
  515.      the following note:
  516.  
  517.           This is the patched assembler, to patch SR#1653-010439, where
  518.           the assembler aborts on floating point constants.
  519.  
  520.           The bug is not really in the assembler, but in the shared
  521.           library version of the function "cvtnum(3c)".  The bug on
  522.           "cvtnum(3c)" is SR#4701-078451.  Anyway, the attached
  523.           assembler uses the archive library version of "cvtnum(3c)"
  524.           and thus does not exhibit the bug.
  525.  
  526.      This patch is also known as PHCO_0800.
  527.  
  528.    * On HP-UX version 8.05, but not on 8.07 or more recent versions,
  529.      the `fixproto' shell script triggers a bug in the system shell.
  530.      If you encounter this problem, upgrade your operating system or
  531.      use BASH (the GNU shell) to run `fixproto'.
  532.  
  533.    * Some versions of the Pyramid C compiler are reported to be unable
  534.      to compile GNU CC.  You must use an older version of GNU CC for
  535.      bootstrapping.  One indication of this problem is if you get a
  536.      crash when GNU CC compiles the function `muldi3' in file
  537.      `libgcc2.c'.
  538.  
  539.      You may be able to succeed by getting GNU CC version 1, installing
  540.      it, and using it to compile GNU CC version 2.  The bug in the
  541.      Pyramid C compiler does not seem to affect GNU CC version 1.
  542.  
  543.    * There may be similar problems on System V Release 3.1 on 386
  544.      systems.
  545.  
  546.    * On the Intel Paragon (an i860 machine), if you are using operating
  547.      system version 1.0, you will get warnings or errors about
  548.      redefinition of `va_arg' when you build GNU CC.
  549.  
  550.      If this happens, then you need to link most programs with the
  551.      library `iclib.a'.  You must also modify `stdio.h' as follows:
  552.      before the lines
  553.  
  554.           #if     defined(__i860__) && !defined(_VA_LIST)
  555.           #include <va_list.h>
  556.  
  557.      insert the line
  558.  
  559.           #if __PGC__
  560.  
  561.      and after the lines
  562.  
  563.           extern int  vprintf(const char *, va_list );
  564.           extern int  vsprintf(char *, const char *, va_list );
  565.           #endif
  566.  
  567.      insert the line
  568.  
  569.           #endif /* __PGC__ */
  570.  
  571.      These problems don't exist in operating system version 1.1.
  572.  
  573.    * On the Altos 3068, programs compiled with GNU CC won't work unless
  574.      you fix a kernel bug.  This happens using system versions V.2.2
  575.      1.0gT1 and V.2.2 1.0e and perhaps later versions as well.  See the
  576.      file `README.ALTOS'.
  577.  
  578.    * You will get several sorts of compilation and linking errors on the
  579.      we32k if you don't follow the special instructions.  *Note
  580.      Configurations::.
  581.  
  582.    * A bug in the HP-UX 8.05 (and earlier) shell will cause the fixproto
  583.      program to report an error of the form:
  584.  
  585.           ./fixproto: sh internal 1K buffer overflow
  586.  
  587.      To fix this, change the first line of the fixproto script to look
  588.      like:
  589.  
  590.           #!/bin/ksh
  591.  
  592. File: gcc.info,  Node: Cross-Compiler Problems,  Next: Interoperation,  Prev: Installation Problems,  Up: Trouble
  593.  
  594. Cross-Compiler Problems
  595. =======================
  596.  
  597.    You may run into problems with cross compilation on certain machines,
  598. for several reasons.
  599.  
  600.    * Cross compilation can run into trouble for certain machines because
  601.      some target machines' assemblers require floating point numbers to
  602.      be written as *integer* constants in certain contexts.
  603.  
  604.      The compiler writes these integer constants by examining the
  605.      floating point value as an integer and printing that integer,
  606.      because this is simple to write and independent of the details of
  607.      the floating point representation.  But this does not work if the
  608.      compiler is running on a different machine with an incompatible
  609.      floating point format, or even a different byte-ordering.
  610.  
  611.      In addition, correct constant folding of floating point values
  612.      requires representing them in the target machine's format.  (The C
  613.      standard does not quite require this, but in practice it is the
  614.      only way to win.)
  615.  
  616.      It is now possible to overcome these problems by defining macros
  617.      such as `REAL_VALUE_TYPE'.  But doing so is a substantial amount of
  618.      work for each target machine.  *Note Cross-compilation::.
  619.  
  620.    * At present, the program `mips-tfile' which adds debug support to
  621.      object files on MIPS systems does not work in a cross compile
  622.      environment.
  623.  
  624. File: gcc.info,  Node: Interoperation,  Next: External Bugs,  Prev: Cross-Compiler Problems,  Up: Trouble
  625.  
  626. Interoperation
  627. ==============
  628.  
  629.    This section lists various difficulties encountered in using GNU C or
  630. GNU C++ together with other compilers or with the assemblers, linkers,
  631. libraries and debuggers on certain systems.
  632.  
  633.    * Objective C does not work on the RS/6000.
  634.  
  635.    * GNU C++ does not do name mangling in the same way as other C++
  636.      compilers.  This means that object files compiled with one compiler
  637.      cannot be used with another.
  638.  
  639.      This effect is intentional, to protect you from more subtle
  640.      problems.  Compilers differ as to many internal details of C++
  641.      implementation, including: how class instances are laid out, how
  642.      multiple inheritance is implemented, and how virtual function
  643.      calls are handled.  If the name encoding were made the same, your
  644.      programs would link against libraries provided from other
  645.      compilers--but the programs would then crash when run.
  646.      Incompatible libraries are then detected at link time, rather than
  647.      at run time.
  648.  
  649.    * Older GDB versions sometimes fail to read the output of GNU CC
  650.      version 2.  If you have trouble, get GDB version 4.4 or later.
  651.  
  652.    * DBX rejects some files produced by GNU CC, though it accepts
  653.      similar constructs in output from PCC.  Until someone can supply a
  654.      coherent description of what is valid DBX input and what is not,
  655.      there is nothing I can do about these problems.  You are on your
  656.      own.
  657.  
  658.    * The GNU assembler (GAS) does not support PIC.  To generate PIC
  659.      code, you must use some other assembler, such as `/bin/as'.
  660.  
  661.    * On some BSD systems, including some versions of Ultrix, use of
  662.      profiling causes static variable destructors (currently used only
  663.      in C++) not to be run.
  664.  
  665.    * Use of `-I/usr/include' may cause trouble.
  666.  
  667.      Many systems come with header files that won't work with GNU CC
  668.      unless corrected by `fixincludes'.  The corrected header files go
  669.      in a new directory; GNU CC searches this directory before
  670.      `/usr/include'.  If you use `-I/usr/include', this tells GNU CC to
  671.      search `/usr/include' earlier on, before the corrected headers.
  672.      The result is that you get the uncorrected header files.
  673.  
  674.      Instead, you should use these options (when compiling C programs):
  675.  
  676.           -I/usr/local/lib/gcc-lib/TARGET/VERSION/include -I/usr/include
  677.  
  678.      For C++ programs, GNU CC also uses a special directory that
  679.      defines C++ interfaces to standard C subroutines.  This directory
  680.      is meant to be searched *before* other standard include
  681.      directories, so that it takes precedence.  If you are compiling
  682.      C++ programs and specifying include directories explicitly, use
  683.      this option first, then the two options above:
  684.  
  685.           -I/usr/local/lib/g++-include
  686.  
  687.    * On some SGI systems, when you use `-lgl_s' as an option, it gets
  688.      translated magically to `-lgl_s -lX11_s -lc_s'.  Naturally, this
  689.      does not happen when you use GNU CC.  You must specify all three
  690.      options explicitly.
  691.  
  692.    * On a Sparc, GNU CC aligns all values of type `double' on an 8-byte
  693.      boundary, and it expects every `double' to be so aligned.  The Sun
  694.      compiler usually gives `double' values 8-byte alignment, with one
  695.      exception: function arguments of type `double' may not be aligned.
  696.  
  697.      As a result, if a function compiled with Sun CC takes the address
  698.      of an argument of type `double' and passes this pointer of type
  699.      `double *' to a function compiled with GNU CC, dereferencing the
  700.      pointer may cause a fatal signal.
  701.  
  702.      One way to solve this problem is to compile your entire program
  703.      with GNU CC.  Another solution is to modify the function that is
  704.      compiled with Sun CC to copy the argument into a local variable;
  705.      local variables are always properly aligned.  A third solution is
  706.      to modify the function that uses the pointer to dereference it via
  707.      the following function `access_double' instead of directly with
  708.      `*':
  709.  
  710.           inline double
  711.           access_double (double *unaligned_ptr)
  712.           {
  713.             union d2i { double d; int i[2]; };
  714.           
  715.             union d2i *p = (union d2i *) unaligned_ptr;
  716.             union d2i u;
  717.           
  718.             u.i[0] = p->i[0];
  719.             u.i[1] = p->i[1];
  720.           
  721.             return u.d;
  722.           }
  723.  
  724.      Storing into the pointer can be done likewise with the same union.
  725.  
  726.    * On Solaris, the `malloc' function in the `libmalloc.a' library may
  727.      allocate memory that is only 4 byte aligned.  Since GNU CC on the
  728.      Sparc assumes that doubles are 8 byte aligned, this may result in a
  729.      fatal signal if doubles are stored in memory allocated by the
  730.      `libmalloc.a' library.
  731.  
  732.      The solution is to not use the `libmalloc.a' library.  Use instead
  733.      `malloc' and related functions from `libc.a'; they do not have
  734.      this problem.
  735.  
  736.    * On a Sun, linking using GNU CC fails to find a shared library and
  737.      reports that the library doesn't exist at all.
  738.  
  739.      This happens if you are using the GNU linker, because it does only
  740.      static linking and looks only for unshared libraries.  If you have
  741.      a shared library with no unshared counterpart, the GNU linker
  742.      won't find anything.
  743.  
  744.      We hope to make a linker which supports Sun shared libraries, but
  745.      please don't ask when it will be finished--we don't know.
  746.  
  747.    * Sun forgot to include a static version of `libdl.a' with some
  748.      versions of SunOS (mainly 4.1).  This results in undefined symbols
  749.      when linking static binaries (that is, if you use `-static').  If
  750.      you see undefined symbols `_dlclose', `_dlsym' or `_dlopen' when
  751.      linking, compile and link against the file `mit/util/misc/dlsym.c'
  752.      from the MIT version of X windows.
  753.  
  754.    * The 128-bit long double format that the Sparc port supports
  755.      currently works by using the architecturally defined quad-word
  756.      floating point instructions.  Since there is no hardware that
  757.      supports these instructions they must be emulated by the operating
  758.      system.  Long doubles do not work in Sun OS versions 4.0.3 and
  759.      earlier, because the kernel eumulator uses an obsolete and
  760.      incompatible format.  Long doubles do not work in Sun OS versions
  761.      4.1.1 to 4.1.3 because of emululator bugs that cause random
  762.      unpredicatable failures.  Long doubles appear to work in Sun OS 5.x
  763.      (Solaris 2.x).
  764.  
  765.    * On HP-UX version 9.01 on the HP PA, the HP compiler `cc' does not
  766.      compile GNU CC correctly.  We do not yet know why.  However, GNU CC
  767.      compiled on earlier HP-UX versions works properly on HP-UX 9.01
  768.      and can compile itself properly on 9.01.
  769.  
  770.    * On the HP PA machine, ADB sometimes fails to work on functions
  771.      compiled with GNU CC.  Specifically, it fails to work on functions
  772.      that use `alloca' or variable-size arrays.  This is because GNU CC
  773.      doesn't generate HP-UX unwind descriptors for such functions.  It
  774.      may even be impossible to generate them.
  775.  
  776.    * Debugging (`-g') is not supported on the HP PA machine, unless you
  777.      use the preliminary GNU tools (*note Installation::.).
  778.  
  779.    * Taking the address of a label may generate errors from the HP-UX
  780.      PA assembler.  GAS for the PA does not have this problem.
  781.  
  782.    * Using floating point parameters for indirect calls to static
  783.      functions will not work when using the HP assembler.  There simply
  784.      is no way for GCC to specify what registers hold arguments for
  785.      static functions when using the HP assembler.  GAS for the PA does
  786.      not have this problem.
  787.  
  788.    * For some very large functions you may receive errors from the HP
  789.      linker complaining about an out of bounds unconditional branch
  790.      offset.  Fixing this problem correctly requires fixing problems in
  791.      GNU CC and GAS.  We hope to fix this in time for GNU CC 2.6.
  792.      Until then you can work around by making your function smaller,
  793.      and if you are using GAS, splitting the function into multiple
  794.      source files may be necessary.
  795.  
  796.    * GNU CC compiled code sometimes emits warnings from the HP-UX
  797.      assembler of the form:
  798.  
  799.           (warning) Use of GR3 when
  800.             frame >= 8192 may cause conflict.
  801.  
  802.      These warnings are harmless and can be safely ignored.
  803.  
  804.    * The current version of the assembler (`/bin/as') for the RS/6000
  805.      has certain problems that prevent the `-g' option in GCC from
  806.      working.  Note that `Makefile.in' uses `-g' by default when
  807.      compiling `libgcc2.c'.
  808.  
  809.      IBM has produced a fixed version of the assembler.  The upgraded
  810.      assembler unfortunately was not included in any of the AIX 3.2
  811.      update PTF releases (3.2.2, 3.2.3, or 3.2.3e).  Users of AIX 3.1
  812.      should request PTF U403044 from IBM and users of AIX 3.2 should
  813.      request PTF U416277.  See the file `README.RS6000' for more
  814.      details on these updates.
  815.  
  816.      You can test for the presense of a fixed assembler by using the
  817.      command
  818.  
  819.           as -u < /dev/null
  820.  
  821.      If the command exits normally, the assembler fix already is
  822.      installed.  If the assembler complains that "-u" is an unknown
  823.      flag, you need to order the fix.
  824.  
  825.    * On the IBM RS/6000, compiling code of the form
  826.  
  827.           extern int foo;
  828.           
  829.           ... foo ...
  830.           
  831.           static int foo;
  832.  
  833.      will cause the linker to report an undefined symbol `foo'.
  834.      Although this behavior differs from most other systems, it is not a
  835.      bug because redefining an `extern' variable as `static' is
  836.      undefined in ANSI C.
  837.  
  838.    * AIX on the RS/6000 provides support (NLS) for environments outside
  839.      of the United States.  Compilers and assemblers use NLS to support
  840.      locale-specific representations of various objects including
  841.      floating-point numbers ("." vs "," for separating decimal
  842.      fractions).  There have been problems reported where the library
  843.      linked with GCC does not produce the same floating-point formats
  844.      that the assembler accepts.  If you have this problem, set the
  845.      LANG environment variable to "C" or "En_US".
  846.  
  847.    * Even if you specify `-fdollars-in-identifiers', you cannot
  848.      successfully use `$' in identifiers on the RS/6000 due to a
  849.      restriction in the IBM assembler.  GAS supports these identifiers.
  850.  
  851.    * On the RS/6000, XLC version 1.3.0.0 will miscompile `jump.c'.  XLC
  852.      version 1.3.0.1 or later fixes this problem.  You can obtain
  853.      XLC-1.3.0.2 by requesting PTF 421749 from IBM.
  854.  
  855.    * There is an assembler bug in versions of DG/UX prior to 5.4.2.01
  856.      that occurs when the `fldcr' instruction is used.  GNU CC uses
  857.      `fldcr' on the 88100 to serialize volatile memory references.  Use
  858.      the option `-mno-serialize-volatile' if your version of the
  859.      assembler has this bug.
  860.  
  861.    * On VMS, GAS versions 1.38.1 and earlier may cause spurious warning
  862.      messages from the linker.  These warning messages complain of
  863.      mismatched psect attributes.  You can ignore them.  *Note VMS
  864.      Install::.
  865.  
  866.    * On NewsOS version 3, if you include both of the files `stddef.h'
  867.      and `sys/types.h', you get an error because there are two typedefs
  868.      of `size_t'.  You should change `sys/types.h' by adding these
  869.      lines around the definition of `size_t':
  870.  
  871.           #ifndef _SIZE_T
  872.           #define _SIZE_T
  873.           ACTUAL TYPEDEF HERE
  874.           #endif
  875.  
  876.    * On the Alliant, the system's own convention for returning
  877.      structures and unions is unusual, and is not compatible with GNU
  878.      CC no matter what options are used.
  879.  
  880.    * On the IBM RT PC, the MetaWare HighC compiler (hc) uses a different
  881.      convention for structure and union returning.  Use the option
  882.      `-mhc-struct-return' to tell GNU CC to use a convention compatible
  883.      with it.
  884.  
  885.    * On Ultrix, the Fortran compiler expects registers 2 through 5 to
  886.      be saved by function calls.  However, the C compiler uses
  887.      conventions compatible with BSD Unix: registers 2 through 5 may be
  888.      clobbered by function calls.
  889.  
  890.      GNU CC uses the same convention as the Ultrix C compiler.  You can
  891.      use these options to produce code compatible with the Fortran
  892.      compiler:
  893.  
  894.           -fcall-saved-r2 -fcall-saved-r3 -fcall-saved-r4 -fcall-saved-r5
  895.  
  896.    * On the WE32k, you may find that programs compiled with GNU CC do
  897.      not work with the standard shared C ilbrary.  You may need to link
  898.      with the ordinary C compiler.  If you do so, you must specify the
  899.      following options:
  900.  
  901.           -L/usr/local/lib/gcc-lib/we32k-att-sysv/2.6.0 -lgcc -lc_s
  902.  
  903.      The first specifies where to find the library `libgcc.a' specified
  904.      with the `-lgcc' option.
  905.  
  906.      GNU CC does linking by invoking `ld', just as `cc' does, and there
  907.      is no reason why it *should* matter which compilation program you
  908.      use to invoke `ld'.  If someone tracks this problem down, it can
  909.      probably be fixed easily.
  910.  
  911.    * On the Alpha, you may get assembler errors about invalid syntax as
  912.      a result of floating point constants.  This is due to a bug in the
  913.      C library functions `ecvt', `fcvt' and `gcvt'.  Given valid
  914.      floating point numbers, they sometimes print `NaN'.
  915.  
  916.    * On Irix 4.0.5F (and perhaps in some other versions), an assembler
  917.      bug sometimes reorders instructions incorrectly when optimization
  918.      is turned on.  If you think this may be happening to you, try
  919.      using the GNU assembler; GAS version 2.1 supports ECOFF on Irix.
  920.  
  921.      Or use the `-noasmopt' option when you compile GNU CC with itself,
  922.      and then again when you compile your program.  (This is a temporary
  923.      kludge to turn off assembler optimization on Irix.)  If this
  924.      proves to be what you need, edit the assembler spec in the file
  925.      `specs' so that it unconditionally passes `-O0' to the assembler,
  926.      and never passes `-O2' or `-O3'.
  927.  
  928. File: gcc.info,  Node: External Bugs,  Next: Incompatibilities,  Prev: Interoperation,  Up: Trouble
  929.  
  930. Problems Compiling Certain Programs
  931. ===================================
  932.  
  933.    * Parse errors may occur compiling X11 on a Decstation running
  934.      Ultrix 4.2 because of problems in DEC's versions of the X11 header
  935.      files `X11/Xlib.h' and `X11/Xutil.h'.  People recommend adding
  936.      `-I/usr/include/mit' to use the MIT versions of the header files,
  937.      using the `-traditional' switch to turn off ANSI C, or fixing the
  938.      header files by adding this:
  939.  
  940.           #ifdef __STDC__
  941.           #define NeedFunctionPrototypes 0
  942.           #endif
  943.  
  944.    * If you have trouble compiling Perl on a SunOS 4 system, it may be
  945.      because Perl specifies `-I/usr/ucbinclude'.  This accesses the
  946.      unfixed header files.  Perl specifies the options
  947.  
  948.           -traditional -Dvolatile=__volatile__
  949.           -I/usr/include/sun -I/usr/ucbinclude
  950.           -fpcc-struct-return
  951.  
  952.      most of which are unnecessary with GCC 2.4.5 and newer versions.
  953.      You can make a properly working Perl by setting `ccflags' to
  954.      `-fwritable-strings' (implied by the `-traditional' in the
  955.      original options) and `cppflags' to empty in `config.sh', then
  956.      typing `./doSH; make depend; make'.
  957.  
  958.    * On various 386 Unix systems derived from System V, including SCO,
  959.      ISC, and ESIX, you may get error messages about running out of
  960.      virtual memory while compiling certain programs.
  961.  
  962.      You can prevent this problem by linking GNU CC with the GNU malloc
  963.      (which thus replaces the malloc that comes with the system).  GNU
  964.      malloc is available as a separate package, and also in the file
  965.      `src/gmalloc.c' in the GNU Emacs 19 distribution.
  966.  
  967.      If you have installed GNU malloc as a separate library package,
  968.      use this option when you relink GNU CC:
  969.  
  970.           MALLOC=/usr/local/lib/libgmalloc.a
  971.  
  972.      Alternatively, if you have compiled `gmalloc.c' from Emacs 19, copy
  973.      the object file to `gmalloc.o' and use this option when you relink
  974.      GNU CC:
  975.  
  976.           MALLOC=gmalloc.o
  977.  
  978.